<?php
//Kiem tra NSD hien thoi co quyen cap nhat tren mot so dau muc cong viec hay la tat ca
if($_ISA_CURRENT_MODUL_CODE == "HANDLE" || $_ISA_CURRENT_MODUL_CODE == "RECEIVE_RESULT"){
	if(onegate_is_permission_update_rate_of_progress_for_recordtype($v_staff_id,0,$_SESSION["recordtype"])){
		$v_permisstion_rate_of_progess = 1;
	}else{
		$v_permisstion_rate_of_progess = 0;
	}	
}	

$v_status = 1;
$v_filter = "";
$v_recordtype_filter = $_SESSION['onegate_current_recordtype'];
if(_is_sqlserver()){
	$sql = "Exec ONEGATE_WorktypeGetAll  ";
	$sql = $sql .$v_status;
	$sql = $sql .",'".$v_filter."'";
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$arr_all_worktype = $ado_conn->GetAll($sql);
	$v_count_worktype = sizeof($arr_all_worktype);
	
	$sql = "Exec Onegate_RecordWorkGetAllByRecordtype  ";
	$sql = $sql ."'" . $v_recordtype_filter . "'";
	$sql = $sql ."," . $v_permisstion_rate_of_progess;
	$sql = $sql ."," . $v_staff_id;
	
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$arr_all_recordwork_by_recordtype = $ado_conn->GetAll($sql);
	$v_count_recordwork_by_recordtype = sizeof ($arr_all_recordwork_by_recordtype);
	///
		
	$sql = "Exec Onegate_RecordWorkGetAllByRecordtype_thue  ";
	$sql = $sql ."'" . $v_recordtype_filter . "'";
	//$sql = $sql ."," . $v_staff_id;
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$arr_all_recordwork_by_recordtype_thue = $ado_conn->GetAll($sql);
	$arr_single_recordwork_by_recordtype_thue=$arr_all_recordwork_by_recordtype_thue[0];
	$v_count_notify_recordwork=sizeof($arr_all_recordwork_by_recordtype_thue);
	
	$v_record_work_worktype = _replace_bad_char($arr_single_recordwork_by_recordtype_thue['PK_WORKTYPE']);
	//$v_worktype_id = $arr_single_recordwork_by_recordtype_thue['PK_WORKTYPE'];
	$vvv=$arr_single_recordwork_by_recordtype_thue['PK_WORKTYPE'];
	////////////////////////////
	$sql = "Exec Onegate_RecordWorkSingleByRecordtype_leav  ";
	$sql = $sql ."'" . $v_recordtype_filter . "'";
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$result = $ado_conn->GetAll($sql);
	$v_size=sizeof($result);
	
	
}?>
